﻿using PDFDesign.Model;

namespace PDFDesign.ViewModel
{
    public class ColumnViewModel : BaseViewModel
    {
        public ColumnViewModel(Column column)
        {
            Column = column;
            name = column.Name;
            fixedWidth = column.FixedWidth;
            precent = column.Precent;
            width = column.Width;
        }

        public Column Column { get; set; }

        public void Save()
        {
            Column.Name = name;
            Column.FixedWidth = fixedWidth;
            Column.Precent = precent;
            Column.Width = width;
        }

        private string name;
        public string Name
        {
            get => name;
            set
            {
                name = value;
                OnPropertyChanged("Name");
            }
        }

        private bool fixedWidth;
        public bool FixedWidth
        {
            get => fixedWidth;
            set
            {
                fixedWidth = value;
                OnPropertyChanged("FixedWidth");
            }
        }

        private double precent;
        public double Precent
        {
            get => precent;
            set
            {
                precent = value;
                OnPropertyChanged("Precent");
            }
        }

        private double width;
        public double Width
        {
            get => width;
            set
            {
                width = value;
                OnPropertyChanged("Width");
            }
        }
    }
}
